package com.study.spring.proxy;

/**
 * static proxy test demo
 */
public class StaticProxyTest {

    public static void main(String[] args) {

        ProductCloth proxy = new ProxyProductCloth(new ProductClothFactory());

        proxy.productCloth();
    }

}

interface ProductCloth {

    void productCloth();

}

// 代理类对象
class ProxyProductCloth implements ProductCloth {
    private ProductCloth productCloth;

    ProxyProductCloth(ProductCloth productCloth) {
        this.productCloth = productCloth;
    }

    public void productCloth() {

        System.out.println("do some things before product");
        productCloth.productCloth();
        System.out.println("do some things after product");
    }

}
// 被代理类

class ProductClothFactory implements ProductCloth {

    public void productCloth() {
        System.out.println("Product Cloth by factory");
    }
}

